#include "select5.h"
#include <iostream>
#include <vector>

template<>
struct std::less<std::pair<int,int> > : binary_function<std::pair<int,int>,std::pair<int,int>,bool> 
{
	bool operator() (const std::pair<int,int>& x, const std::pair<int,int>& y) const
    {return x.second < y.second;}
};

void test5()
{	
	std::vector<std::pair<int,int> > data(10);
	data[0].first = 0; data[0].second = 5;
	data[1].first = 1; data[1].second = 5;

	std::pair<int,int> result = select_0_2<0,1>(data[0],data[1],std::less<std::pair<int,int> >());
	std::cout << result.first << " --> " << result.second << std::endl;

	result = select_0_2<1,0>(data[1],data[0],std::less<std::pair<int,int> >());
	std::cout << result.first << " --> " << result.second << std::endl;

	data[2].first = 2; data[2].second = 5;
	data[3].first = 3; data[3].second = 5;
	result = select_1_4<0,1,2,3>(data[0],data[1],data[2],data[3],std::less<std::pair<int,int> >());
	std::cout << result.first << " --> " << result.second << std::endl;

	data[4].first = 4; data[4].second = 5;
	result = select_2_5_ab_cd<0,1,2,3,4>(data[0],data[1],data[2],data[3],data[4],std::less<std::pair<int,int> >());
	std::cout << result.first << " --> " << result.second << std::endl;
	result = select_1_4_ab<2,3,1,4>(data[2],data[3],data[1],data[4],std::less<std::pair<int,int> >());
	std::cout << result.first << " --> " << result.second << std::endl;
}